{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Wed Sep  4 03:46:01 2019       \r\n",
      "+-----------------------------------------------------------------------------+\r\n",
      "| NVIDIA-SMI 418.56       Driver Version: 418.56       CUDA Version: 10.1     |\r\n",
      "|-------------------------------+----------------------+----------------------+\r\n",
      "| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |\r\n",
      "| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |\r\n",
      "|===============================+======================+======================|\r\n",
      "|   0  GeForce GTX TIT...  Off  | 00000000:01:00.0  On |                  N/A |\r\n",
      "| 22%   37C    P8    15W / 250W |    413MiB / 12211MiB |      0%      Default |\r\n",
      "+-------------------------------+----------------------+----------------------+\r\n",
      "                                                                               \r\n",
      "+-----------------------------------------------------------------------------+\r\n",
      "| Processes:                                                       GPU Memory |\r\n",
      "|  GPU       PID   Type   Process name                             Usage      |\r\n",
      "|=============================================================================|\r\n",
      "+-----------------------------------------------------------------------------+\r\n"
     ]
    }
   ],
   "source": [
    "# Check that the GPU exists.\n",
    "! nvidia-smi"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Check: is GPU Available?\n",
      "True\n",
      "Note that this will still run if it's not, but it will run a lot slower.\n"
     ]
    }
   ],
   "source": [
    "import tensorflow as tf\n",
    "print(\"Check: is GPU Available?\")\n",
    "print(tf.test.is_gpu_available())\n",
    "print(\"Note that this will still run if it's not, but it will run a lot slower.\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "WARNING:tensorflow:From /bts/bts_dataloader.py:68: to_float (from tensorflow.python.ops.math_ops) is deprecated and will be removed in a future version.\n",
      "Instructions for updating:\n",
      "Use tf.cast instead.\n",
      "WARNING:tensorflow:From /usr/local/lib/python2.7/dist-packages/tensorflow/python/data/ops/dataset_ops.py:1419: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version.\n",
      "Instructions for updating:\n",
      "Colocations handled automatically by placer.\n",
      "==================================\n",
      " upconv5 in/out: 2208 / 512\n",
      "  iconv5 in/out: 896 / 512\n",
      " upconv4 in/out: 512 / 256\n",
      "  iconv4 in/out: 448 / 256\n",
      "    aspp in/out: 896 / 128\n",
      "reduc8x8 in/out: 128 / 4\n",
      "  lpg8x8 in/out: 4 / 1\n",
      " upconv3 in/out: 128 / 128\n",
      "  iconv3 in/out: 225 / 128\n",
      "reduc4x4 in/out: 128 / 4\n",
      "  lpg4x4 in/out: 4 / 1\n",
      " upconv2 in/out: 128 / 64\n",
      "  iconv2 in/out: 161 / 64\n",
      "reduc2x2 in/out: 64 / 4\n",
      "  lpg2x2 in/out: 4 / 1\n",
      " upconv1 in/out: 64 / 32\n",
      "  iconv1 in/out: 35 / 32\n",
      "   depth in/out: 32 / 1\n",
      "==================================\n",
      "WARNING:tensorflow:From bts_test.py:97: start_queue_runners (from tensorflow.python.training.queue_runner_impl) is deprecated and will be removed in a future version.\n",
      "Instructions for updating:\n",
      "To construct input pipelines, use the `tf.data` module.\n",
      "WARNING:tensorflow:`tf.train.start_queue_runners()` was called when no queue runners were defined. You can safely remove the call to this deprecated function.\n",
      "WARNING:tensorflow:From /usr/local/lib/python2.7/dist-packages/tensorflow/python/training/saver.py:1266: checkpoint_exists (from tensorflow.python.training.checkpoint_management) is deprecated and will be removed in a future version.\n",
      "Instructions for updating:\n",
      "Use standard file APIs to check for files with this prefix.\n",
      "Now testing 654 files with ./models/bts_nyu/model\n",
      "Processing images..\n",
      "100%|██████████| 654/654 [01:05<00:00,  9.94it/s]\n",
      "Done.\n",
      "Saving result pngs..\n",
      " 38%|███▊      | 251/654 [00:56<01:30,  4.43it/s]bts_test.py:189: RuntimeWarning: divide by zero encountered in log10\n",
      "  plt.imsave(filename_lpg_cmap_png, np.log10(pred_4x4_cropped), cmap='Greys')\n",
      "100%|██████████| 654/654 [02:25<00:00,  4.51it/s]\n"
     ]
    }
   ],
   "source": [
    "! cd /bts && python bts_test.py  \\\n",
    "--encoder densenet161_bts \\\n",
    "--data_path /data/nyu_depth_v2/official_splits/test/ \\\n",
    "--dataset nyu \\\n",
    "--filenames_file ./train_test_inputs/nyudepthv2_test_files_with_gt.txt \\\n",
    "--model_name bts_nyu \\\n",
    "--checkpoint_path ./models/bts_nyu/model \\\n",
    "--input_height 480 \\\n",
    "--input_width 640 \\\n",
    "--max_depth 10"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.15+"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
